import request from '@/utils/request'

// 获取角色列表
export const getRoleListAPI = () => request({
  url: '/park/sys/role'
})

// 获取所有功能权限
export const getAllPermissionAPI = () => request({
  url: '/park/sys/permision/all/tree'
})

// 获取角色权限点列表
export const getRolePermissionAPI = roleId => request({
  url: `/park/sys/role/${roleId}`
})

// 获取角色关联的成员列表
export const getRoleUserListAPI = data => request({
  url: `/park/sys/roleUser/${data.roleId}`,
  data: {
    page: data.page,
    pageSize: data.pageSize
  }
})

// 新增角色
export const addRoleAPI = data => request({
  url: '/park/sys/role',
  method: 'post',
  data
})

// 查询当前角色详情
export const getRoleDetailAPI = roleId => request({
  url: `/park/sys/role/${roleId}`
})

// 修改角色
export const editRoleAPI = data => request({
  url: '/park/sys/role',
  method: 'put',
  data
})

// 删除角色
export const delRoleAPI = id => request({
  url: `/park/sys/role/${id}`,
  method: 'delete'
})
